{extend name="public/base"/}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
<!-- datepicker statr -->
<link href="__PUBLIC__/plugs/datepicker/css/foundation-datepicker.min.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.js"></script>
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/board/board.min.css">
<!-- datepicker end -->
{/block}
{block name="body"}
<div class="main-box clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<h2>{$meta_title}</h2>
		</div>
	</header>
        <div class="navbar navbar-default">
                <form action="" class="navbar-form form-inline" method="get">
                        <div class="form-group">
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="起始时间" id="start_time" name="start_time" value="{$param['start_time']|default=''}" readonly size="15">
                                    <span class="input-group-addon"><i class="fa fa-th"></i></span>
                                </div>
                                <script>
                                $('#start_time').fdatepicker({
                                        format: 'yyyy-mm-dd',
                                        pickTime: false
                                });
                                </script>					
                        </div>
                    －
                        <div class="form-group">
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="结束时间" id="end_time" name="end_time" value="{$param['end_time']|default=''}" readonly size="15">
                                    <span class="input-group-addon"><i class="fa fa-th"></i></span>
                                </div>
                                <script>
                                $('#end_time').fdatepicker({
                                        format: 'yyyy-mm-dd',
                                        pickTime: false
                                });
                                </script>					
                        </div>

                        <div class="form-group">
                                <div class="select-group">
                                        <select name="category_id" class="form-control" style="width: 180px">
                                            <option value="">全部</option>
                                            <?php foreach($catelist as $k=>$v){ ?>
                                                  <option value='{$k}'>{$v}</option>
                                            <?php } ?>                                            
                                        </select>
                                </div>
                        </div>
                        <div class="form-group">
                                <div class="select-group">
                                    <select name="status"  class="form-control" style="width: 180px">
                                            <option value="">全部</option>
                                                  <option value='0'>未审核</option>                                          
                                                  <option value='1'>审核通过</option>                                          
                                                  <option value='2'>审核拒绝</option>                                          
                                        </select>
                                </div>
                        </div>
                        <div class="form-group">
                                <div class="input-group">
                                        <input type="text" name="title" value="{$param['title']|default=''}" placeholder="标题搜索" class="form-control">
                                </div>
                        </div>
                        <button class="btn btn-primary" type="submit"><i class="fa fa-search"></i> 筛选</button>
                </form>
        </div>
	<div class="main-box-body clearfix">
		<div class="table-responsive clearfix">
			<table class="table table-hover">
				<thead>
					<tr>
						<th>ID</th>
						<th>发布时间</th>
						<th>标题</th>
						<th>投稿人</th>
						<th>类型</th>
						<th>审核状态</th>
                                                <th>浏览量</th>
                                                <th>操作</th>
					</tr>
				</thead>
				<tbody>
					{volist name="list" id="item"}
					<tr>
						<td>{$item['id']}</td>
						<td><?php echo date('Y-m-d H:i:s',$item['create_time']) ?></td>
						<td>{$item['title']}</td>
						<td>{$item['nickname']}</td>
                                                <td>{$item['name']}</td>
                                                <td>{$item['status']|getArticleStatus}</td>
                                                <td>{$item['view_num']}</td>
						<td>                                                  
                                                    <a title="评论管理" href="{:url('comment_index?id='.$item['id'])}">评论管理</a>
                                                    <a title="编辑" href="{:url('article_edit?id='.$item['id'])}">编辑</a>
						    <a title="删除" href="{:url('article_delete?id='.$item['id'])}" class="confirm ajax-get">删除</a>
                                                    <?php if($item['status'] == 1){ ?>
                                                    <a id="btn" style="cursor: pointer" data-clipboard-text='http://xiaoyu.sinmore.vip/#/Main?comefrom=share&catid={$item.category_id}&articleid={$item.id}' >复制链接</a>
						    <?php } ?>
                                                </td>
					</tr>
					{/volist}
				</tbody>
			</table>
			{$list->render()}
		</div>
	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/clipboard.js"></script>
<script type="text/javascript">
    var btn = document.getElementById('btn');
    var clipboard = new ClipboardJS('#btn');//实例化
    //复制成功执行的回调，可选
    clipboard.on('success', function(e) {
        layer.msg('复制成功',{icon:1,time:1000});
    });

    //复制失败执行的回调，可选
    clipboard.on('error', function(e) {
        layer.msg('复制失败',{icon:2,time:1000});
    });
    $('select[name=status]').val('{$param.status|default=""}');
    $('select[name=category_id]').val('{$param.category_id|default=""}');
</script>
</script>
{/block}